/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kylingroup.J2SE.Thread;

/**
 *
 * @author kylin
 */
public class TestThreadYield {
    public static void main(String args[]){
        MyThread4 th1=new MyThread4("th1");
        MyThread4 th2=new MyThread4("th2");
        th1.start();
        th2.start();
    }
}

class MyThread4 extends Thread{
    MyThread4(String s){
        super(s);
    }
    public void run(){
        for(int i=1;i<=100;i++){
            System.out.println(this.getName()+": "+i);
            if(i%10==0){
                yield();
            }
        }
    }
}